package com.zhbit.action;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.zhbit.Service.ContentmangerService;
import com.zhbit.table.Share;

public class WatchcontentAction extends ActionSupport{
	private int id;
	private List sharelist;
	private ContentmangerService cs;
public List getSharelist() {
		return sharelist;
	}
	public void setSharelist(List sharelist) {
		this.sharelist = sharelist;
	}
public void setCs(ContentmangerService cs) {
		this.cs = cs;
	}
	public ContentmangerService getCs() {
		return cs;
	}

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

public String execute() throws Exception {
		
	 List results=cs.findByid(id);
		ArrayList lists=new ArrayList();
		for (int i = 0; i < results.size(); i++) {
		     Object []o=(Object [])results.get(i);
		     HashMap p=new HashMap();	      
		        p.put("content",(String)o[0]);
		        p.put("title",(String)o[1]);
		        p.put("imagpath",(String)o[2]);
		        p.put("watchcount",(Integer)o[3]);
		        p.put("sharetime",(Date)o[4]);
		        p.put("likecount",(Integer)o[5]);
		        p.put("username", (String)o[6]);
		        lists.add(p);
		    }
	
		    setSharelist(lists);
			return SUCCESS;
		}
	

}
